<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${webtitle} -- 管理后台</title>
<style type="text/css">
<!--
td {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	color: #FFFFFF;
}
.title {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	font-weight: bold;
	color: #0D324A;
}
.entySpan{	
	display:-moz-inline-box;
	cursor:pointer;
	width:100px;
}
.selectSpan{	
	display:-moz-inline-box;
	cursor:pointer;
	width:700px;
}
-->
</style>
<script type="text/javascript">
//目录全局变量
var directiory = new Array(
["基地概况"],
["修改密码"]
);

//新建URL地址全局变量
var newURL = new Array(
["/TutorTrain/jsp/background/baseintroduce/addbase.jsp"]
);

//列表URL地址全局变量
var listURL = new Array(
["/TutorTrain/jsp/background/baseintroduce/listBases.action?isBack=1&targetPage=1"]
);

var role = 4;
if(window.attachEvent){
	window.attachEvent('onload',initBackGround);  
}else if(window.addEventListener){
   window.addEventListener('load',initBackGround,false);
}

function initBackGround(){
	var roleObj = document.getElementById("role");
	role = 4; //parseInt(roleObj.value);

	if(role <= 2){
		setCurDirectory(0, 0);
		setNewEntry(0, 0);
		setIframeSrc(0, 0);
	}else if(role == 3){
		setCurDirectory(5, 1);
		setNewEntry(5, 1);
		setIframeSrc(5, 1);
	}else if(role == 4){
		
		setTraineeDirectory();
		setNewEntry(5, 0);
		setIframeSrc(5, 0);
	}
}
//控制子目录的展开与关闭
function controlSubDir(id){
	var subItems = document.getElementById(id+"_sub");
	if(subItems.style.display == "none"){
		expand(id+"_li",id+"_ri",id+"_sub");
	}else{
		close(id+"_li",id+"_ri",id+"_sub");
	}
}

//展开子目录
function expand(liid,riid,subid){
	var lImage = document.getElementById(liid);
	var rImage = document.getElementById(riid);
	var subItems = document.getElementById(subid);
	
	lImage.src = "${website}static/admin/images/titlebar_left_02.gif";
	rImage.src = "${website}static/admin/images/titlebar_right_2.gif";
	subItems.style.display = "block";
}

//关闭子目录
function close(liid,riid,subid){
	var lImage = document.getElementById(liid);
	var rImage = document.getElementById(riid);
	var subItems = document.getElementById(subid);
	
	lImage.src = "${website}static/admin/images/titlebar_left.gif";
	rImage.src = "${website}static/admin/images/titlebar_right.gif";
	subItems.style.display = "none";
}

//设置下拉列表框的值
function setTraineeDirectory(){
	var curDir = document.getElementById("curDirectory");
	//清除下拉列表框中的选项
	curDir.options.length = 0;
	var tempArray = directiory[5];	
	for(var i=0; i<tempArray.length-1; i++){
		var varItem = new Option(tempArray[i], 5+""+i);
		curDir.options.add(varItem); 
	}
	curDir.options[0].selected = true;
}

//设置下拉列表框的值
function setCurDirectory(index, subIndex){
	var curDir = document.getElementById("curDirectory");
	//清除下拉列表框中的选项
	curDir.options.length = 0;
	var tempArray = directiory[index];	
	for(var i=0; i<tempArray.length; i++){
		var varItem = new Option(tempArray[i], index+""+i);
		curDir.options.add(varItem); 
	}
	curDir.options[subIndex].selected = true;
}

//设置iframe的src
function setIframeSrc(index, subIndex){
	var ifrm = document.getElementById("backIframe");
	ifrm.src = listURL[index][subIndex];//+"&rand="+Math.random()
}

//设置iframe的src
function setIframeSrcByURL(URL){
	var ifrm = document.getElementById("backIframe");
	ifrm.src = URL;//+"&rand="+Math.random()
	var newEntry = document.getElementById("newEntry");
	newEntry.style.display = "none";
	
}


//设置新建入口
function setNewEntry(index, subIndex){
	var newEntry = document.getElementById("newEntry");	
	if((index==5&&subIndex<2&&role<4)||(index==4&&subIndex==2&&role<4)){
		newEntry.innerHTML = "";
		newEntry.style.display = "none";
	}else{
		newEntry.style.display = "block";
		var content = "<span onclick=\"setIframeSrcByURL('"+newURL[index][subIndex]+"');\"  class='entySpan'>新建"+directiory[index][subIndex]+"</span>";
		newEntry.innerHTML = content;
	}	
}

//目录点击事件
function clickDirectory(index, subIndex, id){
	if(id!=null && id!=""){
		controlSubDir(id);
	}
	setCurDirectory(index, subIndex);
	setNewEntry(index, subIndex);
	setIframeSrc(index, subIndex);	
}

//点击下拉列表事件
function clickSelect(){
	var selectObj = document.getElementById("curDirectory");
	var value = selectObj.value;
	var index = parseInt(value.substring(0, 1));
	var subIndex = parseInt(value.substring(1, 2));
	
	setIframeSrc(index, subIndex);
	
	setNewEntry(index, subIndex);
}
</script>
</head>

<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginheight="0" marginwidth="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="28%" height="65" background="${website}static/admin/images/banner.gif"><img src="${website}static/admin/images/banner_left.gif" width="321" height="65" /></td>
    <td width="72%" colspan="2" background="${website}static/admin/images/banner.gif">
    	<table width="100%" border="0" cellspacing="0" cellpadding="0">
    		<tr>
    			<td width="50%">
    				<span onclick="setIframeSrcByURL('${website}/admin/resetPw.action');setCurDirectory(8,0);" style="cursor:pointer;">修改密码</span>
       			</td>
    		</tr>
    		<tr>
    			<td height="29">
    				姓名：<s:property value="#session.user.realname"/>
       			</td>
    			<td>    				
    				<span onclick="window.location='/TutorTrain/loadindex.jsp';" style="cursor:pointer;">退出管理</span>
       			</td>
    		</tr>
    	</table>
    </td>
  </tr>
    <tr>
    <td height="6" colspan="3" align="left" valign="top" background="${website}static/admin/images/bg.gif"></td>
  </tr>
  <tr>
    <td height="65" colspan="3" align="left" valign="top" background="${website}static/admin/images/bg.gif"><table width="1004" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="185" align="center" valign="top" background="${website}static/admin/images/left_bg.gif"><table width="185" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="${website}static/admin/images/left_bg_top.gif" width="185" height="5" /></td>
          </tr>
        </table>
          <table width="160" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td colspan="3"><img src="${website}static/admin/images/title.png" width="160" height="65" /></td>
          </tr>
          <s:if test="#session.user.role<=2">
          <tr onclick="clickDirectory(0,0,'bi');" style="cursor:pointer;">
            <td width="26"><img id="bi_li" src="${website}static/admin/images/titlebar_left_02.gif" width="26" height="26" /></td>
            <td width="123" align="left" background="${website}static/admin/images/titlebar_mid.gif" class="title">基地概况</td>
            <td width="11"><img id="bi_ri" src="${website}static/admin/images/titlebar_right_2.gif" width="11" height="26" /></td>
          </tr>
          <tr id="bi_sub" onclick="clickDirectory(0,0);" style="cursor:pointer;">
          	<td colspan="3">
          		<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
          			<td width="26"><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
           			<td width="123" align="left" background="${website}static/admin/images/minibar_mid.gif">　基地概况</td>
            		<td width="11"><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>	
          		</tr></table>
          	</td>            
          </tr>
          <tr onclick="clickDirectory(1,0,'pf');" style="cursor:pointer;">
            <td><img id="pf_li" src="${website}static/admin/images/titlebar_left_02.gif" width="26" height="26" /></td>
            <td align="left" background="${website}static/admin/images/titlebar_mid.gif" class="title">政策文件</td>
            <td><img id="pf_ri" src="${website}static/admin/images/titlebar_right_2.gif" width="11" height="26" /></td>
          </tr>
          <tr id="pf_sub" onclick="clickDirectory(1,0);" style="cursor:pointer;">
          	<td colspan="3">
          		<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
          			<td width="26"><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
           			<td width="123" align="left" background="${website}static/admin/images/minibar_mid.gif">　政策文件</td>
            		<td width="11"><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>	
          		</tr></table>
          	</td>            
          </tr>
          </s:if>
          <s:if test="#session.user.role<=3">
          <tr onclick="clickDirectory(2,0,'wd');" style="cursor:pointer;">
            <td><img id="wd_li" src="${website}static/admin/images/titlebar_left_02.gif" width="26" height="26" /></td>
            <td align="left" background="${website}static/admin/images/titlebar_mid.gif" class="title">工作动态</td>
            <td><img id="wd_ri" src="${website}static/admin/images/titlebar_right_2.gif" width="11" height="26" /></td>
          </tr>
          <tr id="wd_sub">
          	<td colspan="3">
          		<table width="100%" border="0" cellpadding="0" cellspacing="0">
	          		<tr onclick="clickDirectory(2,0);" style="cursor:pointer;">
	          			<td width="26"><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
	           			<td width="123" align="left" background="${website}static/admin/images/minibar_mid.gif">　新闻快讯</td>
	            		<td width="11"><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>	
	          		</tr>
	          		<s:if test="#session.user.role<=2">
	          		<tr onclick="clickDirectory(2,1);" style="cursor:pointer;">
			            <td><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
			            <td align="left" background="${website}static/admin/images/minibar_mid.gif">　通知公告</td>
			            <td><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>
			        </tr>
			        </s:if>
          		</table>
          	</td>            
          </tr> 
          <tr onclick="clickDirectory(3,0,'tw');" style="cursor:pointer;">
            <td><img id="tw_li" src="${website}static/admin/images/titlebar_left_02.gif" width="26" height="26" /></td>
            <td align="left" background="${website}static/admin/images/titlebar_mid.gif" class="title">培训工作</td>
            <td><img id="tw_ri" src="${website}static/admin/images/titlebar_right_2.gif" width="11" height="26" /></td>
          </tr>
          <tr id="tw_sub">
          	<td colspan="3">
          		<table width="100%" border="0" cellpadding="0" cellspacing="0">
	          		<tr onclick="clickDirectory(3,0);" style="cursor:pointer;">
	          			<td width="26"><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
	           			<td width="123" align="left" background="${website}static/admin/images/minibar_mid.gif">　规划总结</td>
	            		<td width="11"><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>	
	          		</tr>
	          		<tr onclick="clickDirectory(3,1);" style="cursor:pointer;">
			            <td><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
			            <td align="left" background="${website}static/admin/images/minibar_mid.gif">　培训动态</td>
			            <td><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>
			        </tr>
			        <tr onclick="clickDirectory(3,2);" style="cursor:pointer;">
			            <td><img src="/${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
			            <td align="left" background="${website}static/admin/images/minibar_mid.gif">　精品课程</td>
			            <td><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>
			        </tr>
          		</table>
          	</td>            
          </tr>   
          </s:if>      
          <tr onclick="clickDirectory(4,0,'sp');" style="cursor:pointer;">
            <td><img id="sp_li" src="${website}static/admin/images/titlebar_left_02.gif" width="26" height="26" /></td>
            <td align="left" background="${website}static/admin/images/titlebar_mid.gif" class="title">研修平台</td>
            <td><img id="sp_ri" src="${website}static/admin/images/titlebar_right_2.gif" width="11" height="26" /></td>
          </tr>
          <tr id="sp_sub">
	          <td colspan="3">
	          	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	          		<s:if test="#session.user.role<=3">
		          		<tr onclick="clickDirectory(4,0);" style="cursor:pointer;">
		          			<td width="26"><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
		           			<td width="123" align="left" background="${website}static/admin/images/minibar_mid.gif">　硕博培养</td>
		            		<td width="11"><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>	
		          		</tr>
		          		<tr onclick="clickDirectory(4,1);" style="cursor:pointer;">
				            <td><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
				            <td align="left" background="${website}static/admin/images/minibar_mid.gif">　科研课题</td>
				            <td><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>
				        </tr>
				       </s:if>
				        <tr onclick="clickDirectory(4,2);" style="cursor:pointer;">
				            <td width="26"><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
				            <td width="123" align="left" background="${website}static/admin/images/minibar_mid.gif">　硕博交流</td>
				            <td width="11"><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>
				        </tr>
				        <s:if test="#session.user.role<=3">
		          		<tr onclick="clickDirectory(4,3);" style="cursor:pointer;">
				            <td><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
				            <td align="left" background="${website}static/admin/images/minibar_mid.gif">　学科带头人</td>
				            <td><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>
				        </tr>
				       </s:if>
	          		</table>    
	          	</td>        
          </tr>          
          <tr onclick="clickDirectory(5,0,'tz');" style="cursor:pointer;">
            <td width="26"><img id="tz_li" src="${website}static/admin/images/titlebar_left_02.gif" width="26" height="26" /></td>
            <td width="123" align="left" background="${website}static/admin/images/titlebar_mid.gif" class="title">学员专区</td>
            <td width="11"><img id="tz_ri" src="${website}static/admin/images/titlebar_right_2.gif" width="11" height="26" /></td>
          </tr>
          <tr id="tz_sub">
          	<td colspan="3" height="252" valign="top">
          		<table width="100%" border="0" cellpadding="0" cellspacing="0">
	          		<tr onclick="clickDirectory(5,0);" style="cursor:pointer;">
	          			<td width="26"><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
	           			<td width="123" align="left" background="${website}static/admin/images/minibar_mid.gif">　学习体会</td>
	            		<td width="11"><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>	
	          		</tr>
	          		<tr onclick="clickDirectory(5,1);" style="cursor:pointer;">
			            <td><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
			            <td align="left" background="${website}static/admin/images/minibar_mid.gif">　建言献策</td>
			            <td><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>
			        </tr>
			        <s:if test="#session.user.role<=3">
			        <tr onclick="clickDirectory(5,2);" style="cursor:pointer;">
			            <td><img src="${website}static/admin/images/minibar_left.gif" width="26" height="22" /></td>
			            <td align="left" background="${website}static/admin/images/minibar_mid.gif">　专项调研</td>
			            <td><img src="${website}static/admin/images/minibar_right.gif" width="11" height="22" /></td>
			        </tr>
			        </s:if>
          		</table>
          	</td>            
          </tr>
        </table></td>
        <td width="19">&nbsp;</td>
        <td width="850" height="768" valign="top">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#66CCFF">
          <tr>
            <td height="30" valign="top" bgcolor="#004A7E">
            	<table width="850" border="0">
            		<tr>
            			<td width="750" style="white-space:nowrap;"><span class="selectSpan">&nbsp;&nbsp;&nbsp;&nbsp;<s:select id="curDirectory" headerKey="0" list="#{'0':'基地概况'}" theme="simple" onchange="clickSelect();"></s:select></span></td>
            		</tr>
            	</table>            	
            </td>            
          </tr>
          <tr>
            <td>
            	<iframe id="backIframe" name="backIframe" frameborder=no scrolling="no" onload="this.height=backIframe.document.body.scrollHeight" width="850" src=""></iframe>
			</td>
          </tr>
         </table>
        
          <p>&nbsp;</p></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="6" colspan="3" align="left" valign="top" background="${website}static/admin/images/b_bg.gif"></td>
  </tr>
</table>
</body>
</html>
